﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Rdz.Utility
{
	public static class ArrayUtility
	{

		public static int FindIndex(string[] SearchedArray, string SearchTerm)
		{
			return FindIndex(SearchedArray, SearchTerm, false);
		}
		public static int FindIndex(string[] SearchedArray, string SearchTerm, bool CaseSensitive)
		{
			if (CaseSensitive)
				return SearchedArray.Select((item, index) => new { Item = item, Position = index }).Where(i => i.Item == SearchTerm).First().Position;
			else
				return SearchedArray.Select((item, index) => new { Item = item, Position = index }).Where(i => i.Item.ToLower() == SearchTerm.ToLower()).First().Position;
		}
	}
}
